#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Graphics3D;
#endregion

namespace Raytrace
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>

        /// This is the main type for your game
        public class Game1 : Microsoft.Xna.Framework.Game
        {
            SceneController scene;

        // the standard constructor
        public Game1()
        {
            scene = new SceneController(this);
            // run at full speed
            IsFixedTimeStep = false;

            // set screen size
            InitScreen();
        }

        // screen constants
        const int SCREEN_WIDTH = 640;
        const int SCREEN_HEIGHT = 480;

        // screen-related init tasks
        public void InitScreen()
        {
            scene.InitScreen();
        }

        /// perform any initialization before game starts
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
        }

        /// Load your graphics content.
        protected override void LoadGraphicsContent(bool loadAllContent)
        {
            scene.LoadGraphicsContent(loadAllContent);
        }

        // set effect parameters for our the materials
        protected void InitEffects()
        {
            this.scene.InitEffects();
        }

        // init meshes before first use
        protected void InitMyMeshes()
        {
            this.scene.InitMyMeshes();
        }

        // map our enums to actual effects, apply selected effect to teapot
        protected void SelectEffect(Graphics3D.SceneController.EffectType type)
        {
            this.scene.SelectEffect(type);
        }

        // make sure player doesn't change textures too fast
        private const double TEXTURE_DELAY = 0.25;
        private double m_timeSinceLastSelectNextEffect = TEXTURE_DELAY;

        // cycle to next effect
        protected void SelectNextEffect()
        {
            this.scene.SelectNextEffect();
        }

        /// Unload your graphics content.
        protected override void UnloadGraphicsContent(bool unloadAllContent)
        {
            this.scene.UnloadGraphicsContent(unloadAllContent);
        }

        /// game logic such as updating the world
        protected override void Update(GameTime gameTime)
        {
            this.scene.Update(gameTime);
            base.Update(gameTime);
        }

        // process input from keyboard and gamepad
        protected void ProcessInput(GamePadState pad1, KeyboardState key1,float elapsed)
        {
            this.scene.ProcessInput(pad1, key1, elapsed);
        }

        /// render game objects
        protected override void Draw(GameTime gameTime)
        {
            this.scene.Draw(gameTime);
            base.Draw(gameTime);
        }

        // draw all meshes
        public void DrawMeshes()
        {
            this.scene.DrawMeshes();
        }
    }
    }

